package sh.action;

import lombok.Data;
import sh.service.CartItemService;

import com.opensymphony.xwork2.ActionSupport;
import sh.service.impl.CartItemServiceImpl;

@Data
public class CartItemAction extends ActionSupport{
	private Long cartItemId;
	private Long bookId;
	private Long cartId;
	
	public String delete(){
		try{
			CartItemService cis = new CartItemServiceImpl();
			cis.remove(cartItemId);
			return "success";
		}catch (Exception e){
			return "fail";
		}
	}
	
	//先不实现
	public String add(){
		CartItemService cis = new CartItemServiceImpl();
		if(cis.add(cartId, bookId)){
			return "success";
		}else{
			return "fail";
		}
	}
}
